package com.hongdee.crm.coupon.service;

import com.hongdee.crm.activity.entity.TCrmCarActivity;
import com.hongdee.crm.approval.entity.TCrmCarApprovalFlowDetail;
import com.hongdee.crm.coupon.entity.TCrmCarCoupon;
import com.hongdee.crm.coupon.entity.TCrmCarCouponReissueApply;
import com.hongdee.crm.coupon.entity.TCrmCarCouponUseRecord;
import com.hongdee.crm.coupon.entity.TInsuranceOrderCoupon;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.util.List;
import java.util.Map;

/**
 * 名  称:ITCrmCarCouponServiceImpl
 * 类  型:${TYPE}
 * 描  述:
 * 路  径:com.hongdee.crm.coupon.service.impl
 * 作  者: 术洪超
 * 日  期:2017-02-28 11:09
 */
public interface ITCrmCarCouponService {

    /**
     * @param uid       登录用户
     * @param start     起始记录
     * @param limit     页面大小
     * @param status    状态
     * @param startDate 查询起始时间
     * @param endDate   查询结束时间
     * @return Map
     * @throws Exception
     * @desc 通过 JDBCDao分页查询
     * @author 术洪超
     */
    public Map page(String activityId, String status, String plateNum, Long startDate, Long endDate, String uid, String start,
                    String limit, String deptId, String createUser, String approvalStatus, String vin,
                    String nameOrTel, String companyId, String area, String brand) throws Exception;

    public Map pageForActivity(String activityId, String status, String plateNum, Long startDate, Long endDate, String uid, String start,
                    String limit, String deptId, String createUser, String approvalStatus, String vin,
                    String nameOrTel, String companyId, String area, String brand) throws Exception;

    /**
     * @param data 要保存的变更的优惠券实体
     * @return Map
     * @throws Exception
     * @desc 保存添加或者修改的实体内容，通过主键判断
     * @author 术洪超
     */
    public TCrmCarCoupon save(TCrmCarCoupon data, String aid, String uid) throws Exception;


    /**
     * @param uid    登录用户ID
     * @param id     主键 ID
     * @param status 状态
     * @return
     * @throws Exception
     * @desc 修改状态
     * @author 术洪超
     */

    public void dayinUpdate(String id, String status, String uid, String youxiaoqi) throws Exception;


    /**
     * @param id     主键 ID
     * @param status 状态
     * @return
     * @throws Exception
     * @desc 修改状态
     * @author 术洪超
     */

    public void update(String id, String status, String uid) throws Exception;


    /**
     * @param id 主键 ID
     * @return ResultEntity
     * @throws Exception
     * @desc 查询活动详情
     * @author 术洪超
     */
    public Map activityInfo(String id, String uid) throws Exception;


    /**
     * @param plateNum 车牌号
     * @return Map
     * @throws Exception
     * @desc 查询车辆详情，填写优惠券信息
     * @author 术洪超
     */
    public Map carCouponInfo(String plateNum, String uid) throws Exception;


    /**
     * @param num        优惠券号
     * @param plateNum   车牌号
     * @param activityId 活动ID
     * @return ResultEntity
     * @throws Exception
     * @desc 查询详情
     * @author 术洪超
     */
    public Map useInfo(String num, String plateNum, String activityId, String uid) throws Exception;


    /**
     * @param id        主键 ID
     * @param status    状态
     * @param gongdanId 工单号
     * @param num       优惠券号
     * @param useRemark 使用方式
     * @return
     * @throws Exception
     * @desc 修改状态
     * @author 术洪超
     */

    public void use(String num, String status, String useRemark, String remainder, String useMoney, String uid, String gongdanId) throws Exception;

    /**
     * @param uid       登录用户
     * @param start     起始记录
     * @param limit     页面大小
     * @param startDate 查询起始时间
     * @param endDate   查询结束时间
     * @return Map
     * @throws Exception
     * @desc 通过 JDBCDao分页查询
     * @author 术洪超
     */
    public Map useRecordPage(String activityId, String plateNum, String startDate, String endDate, String uid, String start,
                             String limit, String companyId, String area, String brand) throws Exception;


    //优惠券补发

    /**
     * @return
     * @throws Exception
     * @desc 要补发的优惠券下拉列表
     * @author 术洪超
     */
    public List<Map> couponReissueCombo(String plateNum, String uid ,String vin) throws Exception;


    /**
     * @param plateNum 车牌号
     * @return ResultEntity
     * @throws Exception
     * @desc 查询补发时优惠券的详情
     * @author 术洪超
     */
    public Map reissueInfo(String plateNum, String uid,String vin) throws Exception;


    /**
     * @param data 要保存的变更的补发的优惠券实体
     * @return
     * @throws Exception
     * @desc 保存添加或者修改的实体内容
     * @author 术洪超
     */
    public TCrmCarCouponReissueApply save(TCrmCarCouponReissueApply data, String uid) throws Exception;


    /**
     * @param uid      登录用户
     * @param start    起始记录
     * @param limit    页面大小
     * @param applyUid 申请用户
     * @return Map
     * @throws Exception
     * @desc 已申请补发的分页查询
     * @author 术洪超
     */
    public Map applyPage(String applyUid, String uid, String start, String limit) throws Exception;


    /**
     * @param num    优惠券号
     * @param status 状态
     * @return
     * @throws Exception
     * @desc 处理补发申请，同意补发修改状态为1，拒绝补发修改状态为2
     * @author 术洪超
     */

    public void applyUpdate(String id, String num, String status, String uid) throws Exception;

    /**
     * @param uid 登录用户ID
     * @param id  申请补发优惠券的ID
     * @return Map
     * @throws Exception
     * @desc 查询申请补发的优惠券的详情
     * @author 术洪超
     */
    public Map applyInfo(String id, String uid) throws Exception;


    /**
     * @param uid      登录用户
     * @param start    起始记录
     * @param limit    页面大小
     * @param plateNum 车牌号
     * @param num      优惠券号
     * @return Map
     * @throws Exception
     * @desc 已同意补发的分页查询
     * @author 术洪超
     */
    public Map reissuePage(String plateNum, String num, String uid, String start, String limit) throws Exception;


    //优惠券激活

    /**
     * @param uid      登录用户
     * @param start    起始记录
     * @param limit    页面大小
     * @param plateNum 车牌号
     * @param num      优惠券号
     * @return Map
     * @throws Exception
     * @desc 通过 JDBCDao分页查询
     * @author 术洪超
     */
    public Map actionPage(String plateNum, String num, String uid, String start, String limit) throws Exception;

    /**
     * @param id 需要激活的优惠券的主键
     * @return Map
     * @throws Exception
     * @desc 查询需要激活的优惠券的详情
     * @author 术洪超
     */
    public Map actionInfo(String id, String uid) throws Exception;

    /**
     * @param id 主键 ID
     * @return
     * @throws Exception
     * @parayouxiaoqi 激活后的有效期
     * @desc 修改状态
     * @author 术洪超
     */

    public void actionUpdate(String id, String uid) throws Exception;


    //地址

    /**
     * @param uid 登录用户ID
     * @return ResultEntity
     * @throws Exception
     * @desc 查询优惠券详情
     * @author 术洪超
     */
    public Map couponInfo(String id, String uid, String aid) throws Exception;

    /***
     * 生成要导出的优惠券记录
     * @param list
     * @param uid
     * @return
     * @throws Exception
     */
    public XSSFWorkbook exportCoupon(boolean isActivity,List list, String uid) throws Exception;

    public List<TCrmCarCoupon> findListCoupon(String activityId, String status, String plateNum, Long startDate, Long endDate,
                                              String uid, String deptId, String createUser, String approvalStatus, String vin,
                                              String nameOrTel, String companyId, String area, String brand) throws Exception;

    public List<TCrmCarCoupon> findListActivity(String activityId, String status, String plateNum, Long startDate, Long endDate,
                                              String uid, String deptId, String createUser, String approvalStatus, String vin,
                                              String nameOrTel, String companyId, String area, String brand) throws Exception;


    public HSSFWorkbook exportRecord(List list, String uid) throws Exception;

    /****
     * 分页查询导出记录
     * @param activityId
     * @param plateNum
     * @param startDate
     * @param endDate
     * @param uid
     * @param start
     * @param limit
     * @param companyId
     * @param area
     * @param brand
     * @return
     * @throws Exception
     */
    public Map findListRecord(String activityId, String plateNum, String startDate, String endDate, String uid, String start,
                              String limit, String companyId, String area, String brand) throws Exception;

    public List<Map<String, Object>> findListCoupono(String activityId, String uid) throws Exception;

    public HSSFWorkbook exportRecordy(List<TCrmCarCoupon> list, String uid) throws Exception;

    /**
     * @param id
     * @param type
     * @param timeType
     * @param startDate
     * @param stopDate
     * @return
     * @throws Exception
     */
    public List CouponPage(String id, String type, String timeType, String startDate, String stopDate) throws Exception;

    /***
     *  将查询出的优惠信息转为Execl
     * @param list
     * @return
     * @throws Exception
     */
    public HSSFWorkbook eCoupon(List list) throws Exception;

    /**
     * 保险代理生成优惠券
     *
     * @param activityId
     * @param carId
     * @param nums
     * @param uid
     * @return
     * @throws Exception
     */
    public List<Map<String, Object>> addInsuranceActivityCoupon(String activityId, String carId, Integer nums,
                                                                String uid, String qId,String companyId) throws Exception;

    /**
     * 获得车辆对应的报价单的优惠券信息
     *
     * @param carId
     * @param qId
     * @return
     * @throws Exception
     */
    public List<Map<String, Object>> getInsuranceActivityCoupon(String qId, String carId,String companyId,String uid) throws Exception;

    /**
     * 删除保险代理生成的优惠券信息
     *
     * @param id
     * @throws Exception
     */
    public void delInsuranceActivityCoupon(String id) throws Exception;

    /**
     * 审核优惠券
     *
     * @param id
     * @throws Exception
     */
    public void updateApprovalStatus(TCrmCarApprovalFlowDetail data, String id, String status, String uid) throws Exception;

    /**
     * 审批优惠券分页
     *
     * @param data
     * @param start
     * @param limit
     * @param uid
     * @return
     * @throws Exception
     */
    public Map approvalPage(Map data, String start, String limit, String uid) throws Exception;

    /**
     * 已审批优惠券分页
     *
     * @param data
     * @param start
     * @param limit
     * @param uid
     * @return
     * @throws Exception
     */
    public Map approvaledPage(Map data, String start, String limit, String uid) throws Exception;

    /**
     * 保单出单查询车辆优惠券
     * @param uid
     * @param companyId
     * @param plateNum
     * @param vin
     * @param activityId
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> insuranceCouponPage(String uid,String companyId,
                                                        String plateNum,String vin,String activityId) throws Exception;

    /**
     * 保存报价单中的赠品信息到临时表中
     * @param uid
     * @param qId
     * @param id
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> insuranceSaveCoupon(String uid,String qId,String id) throws Exception;

    /**
     * 删除保存在临时表中的优惠券信息
     * @param uid
     * @param qId
     * @param id
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> insuranceDelCoupon(String uid,String qId,String id) throws Exception;
}
